package myapp.googlemap;

import java.util.ArrayList;

import myapp.DTO.UserDTO;

import android.app.AlertDialog;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class UserItemizedOverlay extends ItemizedOverlay<OverlayItem>{

	private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
	private Drawable marker=null;
	private UserDTO userDTO;
	
	public UserItemizedOverlay(Drawable defaultMarker) {
		super(defaultMarker);
		// TODO Auto-generated constructor stub
		marker = defaultMarker;
	}

	public UserItemizedOverlay(Drawable defaultMarker, UserDTO userDTO) {
		super(defaultMarker);
		// TODO Auto-generated constructor stub
		marker = defaultMarker;
		this.userDTO = userDTO;
	}
	
	@Override
	protected OverlayItem createItem(int i) {
		// TODO Auto-generated method stub
		return mOverlays.get(i);
	}

	@Override
	public int size() {
		// TODO Auto-generated method stub
		return mOverlays.size();
	}
	
	public void addOverlay(OverlayItem overlay) {
	    mOverlays.add(overlay);overlay.getPoint();
	    populate();
	}

	public void RemoveOverlay(int index)
	{
		mOverlays.remove(index);
		populate();
	}	
	
	@Override
	public void draw(Canvas canvas, MapView mapView, boolean shadow) {
		// TODO Auto-generated method stub
		if (!shadow)
		{
			super.draw(canvas, mapView, shadow);
		}
	}
	@Override
	protected boolean onTap(int index) {
		OverlayItem item = mOverlays.get(index);
		
		return true;
	}
}
